<template>
  <span>{{ headerLabel || label }}</span>
  <el-tooltip :effect="effect" placement="bottom">
    <span class="tableHeaderTip">
      <img src="@/assets/image/notice.png" alt="" />
    </span>
    <template #content>
      <slot name="headerTip">
        <div v-if="tipContentList?.length" class="tip_content_list">
          <p>{{ tipContentTitle }}</p>
          <ul>
            <li v-for="(item, index) in tipContentList" :key="index">
              <span :style="item.spanStyle">{{ item.label }}</span>
              <b :style="item.bStyle"></b>
            </li>
          </ul>
        </div>
      </slot>
    </template>
  </el-tooltip>
</template>
<script setup>
const props = defineProps({
  headerLabel: {
    type: String,
    default: '',
  },
  label: {
    type: String,
    default: '',
  },
  effect: {
    type: String,
    default: 'light',
  },
  tipContentTitle: {
    type: String,
    default: '',
  },
  tipContentList: {
    type: Array,
    default: () => [],
  },
  prop: {
    type: String,
    default: '',
  },
});

const emits = defineEmits(['itemEvent']);
</script>

<style lang="scss" scoped>
.tableHeaderTip {
  img {
    position: relative;
    top: 2px;
    left: 3px;
    cursor: pointer;
  }
}
.tip_content_list {
  p {
    height: 20px;
    font-size: 12px;
    color: #909399;
    line-height: 20px;
    margin-bottom: 7px;
  }
  ul {
    li {
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 32px;
      font-size: 12px;
      color: rgba(0, 0, 0, 0.65);
      span {
        min-width: 90px;
      }
      b {
        display: inline-block;
        width: 20px;
        height: 20px;
      }
    }
  }
}
</style>
